function formatDate(date) {
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0');
    const day = String(date.getDate()).padStart(2, '0');
    return `${year}-${month}-${day}`;
}

function getToday() {
    const today = new Date();
    return formatDate(today);
}

function getYesterday() {
    const yesterday = new Date();
    yesterday.setDate(yesterday.getDate() - 1);
    return formatDate(yesterday);
}

function getLastWeek() {
    const lastWeek = new Date();
    lastWeek.setDate(lastWeek.getDate() - 7);
    return formatDate(lastWeek);
}

function getLastMonth() {
    const lastMonth = new Date();
    lastMonth.setMonth(lastMonth.getMonth() - 1);
    return formatDate(lastMonth);
}

const todayRange = getToday();
const yesterdayRange = getYesterday();
const lastWeekRange = getLastWeek();
const lastMonthRange = getLastMonth();

export const timeRange = {
    today: [todayRange, todayRange],
    yesterday: [yesterdayRange, yesterdayRange],
    lastWeek: [lastWeekRange, todayRange],
    lastMonth: [lastMonthRange, todayRange],
}